package com.zzyl.mapper;

import com.github.pagehelper.Page;
import com.zzyl.dto.ProjectPlanDto;
import com.zzyl.entity.NursingPlan;
import com.zzyl.entity.NursingProject;
import com.zzyl.vo.NursingPlanVo;
import com.zzyl.vo.NursingProjectVo;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface NursingPlanMapper {

    /**
     * 查询所有护理计划
     * @return
     */
    @Select("select * from nursing_plan")
    List<NursingPlan> findAll();


    /**
     * 新增护理计划
     * @param nursingPlan
     */
    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("INSERT INTO zzyl.nursing_plan(sort_no, plan_name, status, create_time,update_time,create_by, update_by, remark)\n" +
            "VALUES(#{sortNo},#{planName}, #{status},#{createTime},#{updateTime},#{createBy}, #{updateBy}, #{remark});")
    void insert(NursingPlan nursingPlan);

    /**
     * 分页查询
     * @param name
     * @param status
     * @return
     */
    Page<NursingProjectVo> selectByPage(String name, Integer status);

    /**
     * 根据id查询
     * @param id
     * @return
     */
    @Select("Select * from nursing_plan where id = #{id}")
    NursingPlan getInfo(@Param("id")Integer id);

    /**
     * 更新护理计划
     */
    void update(NursingPlan nursingPlan);

    /**
     * 根据id删除护理计划
     * @param id
     */
    @Delete("delete from nursing_plan where id = #{id}")
    void batchDel(Integer id);

    /**
     * 启用和禁用
     * @param
     * @param
     */
    void updateStatus(NursingPlan nursingPlan);

}
